GL_GLUT=-lGL -lGLU -lglut
FLAGS=-W -Wall

all : SuleX SulEd mapviewer mapcontrast tpd

tpd : segmenttreelist.o link.o brain.o tools.o map.o trackball.o segment.o segmentlist.o segmenttree.o boundingbox.o vector3d.o define.o mesh.o plan.o tpd.o
	g++ segmenttreelist.o link.o brain.o tools.o map.o trackball.o segment.o segmentlist.o segmenttree.o boundingbox.o vector3d.o define.o mesh.o plan.o tpd.o -o TPD $(GL_GLUT) $(FLAGS)

SuleX : segmenttreelist.o link.o brain.o tools.o map.o trackball.o segment.o segmentlist.o segmenttree.o boundingbox.o vector3d.o define.o mesh.o plan.o main.o
	g++ segmenttreelist.o link.o brain.o tools.o map.o trackball.o segment.o segmentlist.o segmenttree.o boundingbox.o vector3d.o define.o mesh.o plan.o main.o -o SuleX $(GL_GLUT) $(FLAGS)

SulEd : segmenttreelist.o link.o brain.o tools.o map.o trackball.o segment.o segmentlist.o segmenttree.o boundingbox.o vector3d.o define.o mesh.o plan.o sulciseditor.o
	g++ segmenttreelist.o link.o brain.o tools.o map.o trackball.o segment.o segmentlist.o segmenttree.o boundingbox.o vector3d.o define.o mesh.o plan.o sulciseditor.o -o SulEd $(GL_GLUT) $(FLAGS)

mapviewer : segmenttreelist.o link.o brain.o tools.o map.o trackball.o segment.o segmentlist.o segmenttree.o boundingbox.o vector3d.o define.o mesh.o plan.o mapviewer.o
	g++ segmenttreelist.o link.o brain.o tools.o map.o trackball.o segment.o segmentlist.o segmenttree.o boundingbox.o vector3d.o define.o mesh.o plan.o mapviewer.o -o mapviewer $(GL_GLUT) $(FLAGS)

mapcontrast : mapcontrast.o map.o
	g++ mapcontrast.o map.o -o mapcontrast $(FLAGS)

mapcontrast.o : mapcontrast.cpp
	g++ -c mapcontrast.cpp -o mapcontrast.o $(FLAGS)

mapviewer.o : mapviewer.cpp
	g++ -c mapviewer.cpp -o mapviewer.o $(FLAGS)

segmenttreelist.o : segmenttreelist.cpp
	g++ -c segmenttreelist.cpp -o segmenttreelist.o $(FLAGS)

plan.o : plan.cpp
	g++ -c plan.cpp -o plan.o $(FLAGS)

link.o : link.cpp
	g++ -c link.cpp -o link.o $(FLAGS)

brain.o : brain.cpp
	g++ -c brain.cpp -o brain.o $(FLAGS)

boundingbox.o : boundingbox.cpp
	g++ -c boundingbox.cpp -o boundingbox.o $(FLAGS)

trackball.o : trackball.cpp
	g++ -c trackball.cpp -o trackball.o $(FLAGS)

tools.o : tools.cpp
	g++ -c tools.cpp -o tools.o $(FLAGS)

map.o : map.cpp
	g++ -c map.cpp -o map.o $(FLAGS)

segment.o : segment.cpp
	g++ -c segment.cpp -o segment.o $(FLAGS)

segmentlist.o : segmentlist.cpp
	g++ -c segmentlist.cpp -o segmentlist.o

segmenttree.o : segmenttree.cpp
	g++ -c segmenttree.cpp -o segmenttree.o $(FLAGS)

vector3d.o : vector3d.cpp
	g++ -c vector3d.cpp -o vector3d.o $(FLAGS)

define.o : define.cpp
	g++ -c define.cpp -o define.o $(FLAGS)

mesh.o : map.o plan.o mesh.cpp
	g++ -c mesh.cpp -o mesh.o $(FLAGS)

sulciseditor.o : sulciseditor.cpp
	g++ -c sulciseditor.cpp -o sulciseditor.o $(FLAGS)

main.o : main.cpp
	g++ -c main.cpp -o main.o $(FLAGS)

clean :
	rm *.o
